package com.xinyue.utils;

import org.apache.commons.lang3.time.DateFormatUtils;

public class DateUtil {

    public static long getServerTime() {
        return System.currentTimeMillis();
    }

    /**
     * 转换时间格式
     *
     * @param timespen(单位：毫秒)
     * @return String (yyyy-MM-dd HH:mm:ss)
     */
    public static String formatDate(long timespen) {
        return DateFormatUtils.format(timespen, "yyyy-MM-dd HH:mm:ss");
    }
    
    public static void main(String[] args) {
        System.out.println(DateUtil.formatDate(System.currentTimeMillis()));
    }
}
